﻿#ifndef TANK_H
#define TANK_H
#include <math.h>
#include <QWidget>
#include <QPainter>
#include <hand_keys.h>
#include <vector>
#include <map.h>
#include <QPushButton>
#include <random>
#define pai 3.1415926
using namespace std;

extern vector<date_map> maps;
extern int select_view;
extern bool is_up;


struct get_rectangle_xy {
    struct left_top {
        double x, y;
    }lt;
    struct left_bottom {
        double x, y;
    }lb;
    struct right_top {
        double x, y;
    }rt;
    struct right_bottom {
        double x, y;
    }rb;
};


class hand_keys;


class tank:public QWidget
{
public:
    tank();
    tank(QWidget *parent);
    void count_xy(tank& t);
    void paintEvent(QPaintEvent *event);
    int tank_to_wall(tank &t);
    void machine(tank &t);
    friend class hand_keys;
    //tank t1;
public:
    double x,y;
    double r;
    double angle;
    get_rectangle_xy body_xy;
    get_rectangle_xy gun_xy;
    int Record_Live_Time;
    int shoot_time;
    double body_angle = 53;//这里是圆心到右下角tank身体矩形点的角度
    double gun_angle = 82;//跟body_angle同理
    bool isLive = 1;
    int grade=0;
    int player;
private:
    static std::mt19937 gen; // 静态引擎
    static std::uniform_int_distribution<int> dis_x;
    static std::uniform_int_distribution<int> dis_y;
    static std::uniform_int_distribution<int> dis_angle;
};

#endif // TANK_H
